import {GETSELLER,GETSGOODS,GETRATINGS} from "store/mutation_types.js";
import http from "@/http";
export default {
    //请求商家数据
    // 变量的值作为属性名
    async [GETSELLER]({commit,state}){
        //发起请求 当前请求会被mock拦截
        // const {code,data} = await axios.get("/api/seller");
        const {code,data} = await http.seller.getSeller()
        if(code === state.OK){
            commit(GETSELLER,data)
        }
    },
    //请求商品数据
    async [GETSGOODS]({commit,state}){
        // const {code,data} = await axios.get("/api/goods");
        const {code,data} = await http.seller.getGoods()
        if(code === state.OK){
            commit(GETSGOODS,data)
        }
    },
    //请求商品数据
    async [GETRATINGS]({commit,state}){
        // const {code,data} = await axios.get("/api/ratings");
        const {code,data} =await http.seller.getRatings();
        if(code === state.OK){
            commit(GETRATINGS,data)
        }
    }
}